﻿using FastWin32.Diagnostics;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace HookDemo.HookHostProcess
{
    public class InjectService
    {
        //注入的核心dll 路径
        public static string path = AppDomain.CurrentDomain.BaseDirectory + "HookDemo.HookHostCore.dll";

        /// <summary>
        /// 进程id
        /// </summary>
        public static uint pid = 0;

        /// <summary>
        /// 启动
        /// </summary>
        public static void Start()
        {
            Inject();
        }

        #region 私有方法

        private static void Inject()
        {
            try
            {
                Injector.InjectManaged(pid, path, "HookDemo.HookHostCore.HookService", "Start", "", out int returnValue);
            }
            catch (Exception ex)
            {
            }
        }

        #endregion 私有方法
    }
}